package com.njtoyo.taxi.admin.mapper.master.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njtoyo.taxi.admin.library.Const;
import com.njtoyo.taxi.admin.mapper.master.entity.DriverReward;
import com.njtoyo.taxi.admin.mapper.master.enums.DriverRewardCategory;
import com.njtoyo.taxi.admin.rest.presenter.data.allowance.DriverRewardSituationPresenter;
import com.njtoyo.taxi.admin.rest.presenter.finance.vo.FinanceAllowanceStatsAmountVo;
import com.njtoyo.taxi.admin.rest.presenter.finance.vo.FinanceDriverRewardAmountVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Dell
 * @since 2021-07-27
 */
@Repository
@DS(Const.PRIMARY_DS)
public interface DriverRewardMapper extends BaseMapper<DriverReward> {
    List<DriverRewardSituationPresenter> getAmountBySituation(@Param("start") Date start, @Param("end") Date end, @Param("category") DriverRewardCategory category);

    BigDecimal computeDriverBalance(Long driverId);

    List<FinanceAllowanceStatsAmountVo> selectDriverRideReward(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<FinanceDriverRewardAmountVo> selectFinanceDriverRideReward(@Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);

    BigDecimal selectDriverUndrawnBalanceAmountOut(@Param("endTime") DateTime endTime);

}
